package com.jlh.viewer;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.Executors;

/**
 * Created by jlh
 * On 2017/3/24 0024.
 */


public class Test {
    private static Integer a=1;
    private static Integer b=a+1;

    public static void main(String[] args) throws IOException {
        Person[] a= new Person[]{new Person(2),new Person(1),new Person(3)};
        Arrays.stream(a).forEach(System.out::println);
        Arrays.sort(a);
        Arrays.stream(a).forEach(System.out::println);
        HashMap<String,String> mp = new HashMap<>();
        mp.put("key0","0");
        mp.entrySet().forEach(System.out::println);
        mp.entrySet().forEach(m->{
            m.setValue("val"+m.getValue());
        });
        mp.entrySet().forEach(System.out::println);

    }
    public class A{
        private Integer a=2;
        public Integer getA(){
            return a;
        }
    }

    public static class Person implements Comparable<Person>{
        private Integer old;

        public Person(Integer old) {
            this.old = old;
        }

        public Integer getOld() {
            return old;
        }

        public void setOld(Integer old) {
            this.old = old;
        }

        @Override
        public String toString() {
            return "Person{" +
                    "old=" + old +
                    '}';
        }

        @Override
        public int compareTo(Person o) {
            int res=0;
            if (this.old<o.getOld())
                res =-1;
            else
                res=1;
            return res*-1;
        }
    }
}
